package com.caration.shell.config;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import com.caration.shell.cr3d.SharedData;

public final class CompatibilityConfig {
	private static boolean mFolderCache = false;
	private static SharedPreferences mCompatConfig;

	public static void a() {
		if (getSharedPreference().getBoolean(
				"compatibility_folder_cache_judge", false)) {
			mFolderCache = getSharedPreference().getBoolean(
					"compatibility_folder_cache_normal_method_state", true);
		} else {
			Editor editor = getSharedPreference().edit();
			editor.putBoolean("compatibility_folder_cache_judge", true);
			editor.putBoolean("compatibility_folder_cache_normal_method_state",
					false);
			editor.commit();
			//TODO:
			// com.tsf.shell.workspace3D.b.a a1 =
			// com.tsf.shell.workspace3D.b.b.a(
			// 256, 256);
			// Object obj = Bitmap.createBitmap(256, 256,
			// android.graphics.Bitmap.Config.ARGB_8888);
			// TextureElement textureelement1 = com.censivn.C3DEngine.a.h().a(
			// ((Bitmap) (obj)), true);
			// TextureElement textureelement = com.censivn.C3DEngine.a.h().a(
			// ((Bitmap) (obj)), true);
			// ((Bitmap) (obj)).recycle();
			// com.tsf.shell.workspace3D.b.b.a(a1, textureelement1);
			// obj = (GL11ExtensionPack) z.a;
			// ((GL11ExtensionPack) (obj)).glBindFramebufferOES(36160, a1.a);
			// z.a.glBindTexture(3553, textureelement.id);
			// z.a.glCopyTexSubImage2D(3553, 0, 0, 0, 128, 128, 128, 128);
			// z.a.glBindTexture(3553, 0);
			// ((GL11ExtensionPack) (obj)).glBindFramebufferOES(36160, 0);
			// com.tsf.shell.workspace3D.b.b.a(a1);
			// com.censivn.C3DEngine.a.h().a(textureelement1);
			// com.censivn.C3DEngine.a.h().a(textureelement);
			// editor.putBoolean("compatibility_folder_cache_normal_method_state",
			// true);
			// editor.commit();
			mFolderCache = true;
		}
	}

	public static boolean b() {
		return mFolderCache;
	}

	public static void clear() {
		android.content.SharedPreferences.Editor editor = getSharedPreference()
				.edit();
		editor.clear();
		editor.commit();
	}

	private static SharedPreferences getSharedPreference() {
		if (mCompatConfig == null)
			mCompatConfig = SharedData.getContext().getSharedPreferences(
					"compatibility_manager_config", 0);
		return mCompatConfig;
	}
}
